/*******************************************************************************

    Copyright (C) Device VM Inc. All rights reserved.

    FileName:    ResImage.h
    CreateTime:  2009-08-21
    Description: 

    Version history:



*******************************************************************************/

#ifndef __RESIMAGE_H_F35AA0E6_7316_43F0_B81C_968F14883571__
#define __RESIMAGE_H_F35AA0E6_7316_43F0_B81C_968F14883571__


#include <atlstr.h>
#include "GdiplusHelper.h"


class ResImage
{
public:
    ResImage();
    ~ResImage();

public:
    BOOL LoadBitmap(UINT nId);
    BOOL LoadCustomImage(const CString &strResType, UINT nId);

    UINT GetWidth();
    UINT GetHeight();

    // Note: The dc parameter MUST have been created and have selected a bitmap.
    BOOL DrawToDc(CDC &dc, UINT nX = 0, UINT nY = 0, UINT nWidth = 0, UINT nHeight = 0);
    BOOL DrawToDcSpecifyTransparent(CDC &dc, COLORREF crTransparent, UINT nX = 0, UINT nY = 0, UINT nWidth = 0, UINT nHeight = 0);

private:
    enum ImageType
    {
        Bitmap,
        //Icon,
        CustomImage,
        NotLoaded
    };

private:
    BOOL DrawBitmapToDc(CDC &dc, UINT nX = 0, UINT nY = 0, UINT nWidth = 0, UINT nHeight = 0);
    BOOL DrawCustomInageToDc(CDC &dc, UINT nX = 0, UINT nY = 0, UINT nWidth = 0, UINT nHeight = 0);
    void Release();

private:
    ImageType m_it;
    CBitmap m_bmp;
    BITMAP m_bmInfo;
    Gdiplus::Image *m_pImage;

};


#endif // #ifndef __RESIMAGE_H_F35AA0E6_7316_43F0_B81C_968F14883571__
